<template>
  <el-table
    :data="tableData"
    style="width: 100%">
    <el-table-column type="expand">
      <template slot-scope="props">
        <el-form label-position="left" inline class="demo-table-expand">
          <el-form-item label="标题">
            <span>{{ props.row.title }}</span>
          </el-form-item>
          <el-form-item label="内容">
            <span>{{ props.row.message }}</span>
          </el-form-item>
        </el-form>
      </template>
    </el-table-column>
    <el-table-column
      label="发布人"
      prop="person">
    </el-table-column>
    <el-table-column><template slot-scope="scope"><el-button @click="delete(scope.$index)">删除公告</el-button></template></el-table-column>
  </el-table>
</template>

<style>
  .demo-table-expand {
    font-size: 0;
  }
  .demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
  }
</style>

<script>
import store from '../../store'
  export default {
    name:'notice',
    store,
    data() {
      return {
        tableData: [{
          title: store.state.text1,
          message:store.state.text2 ,
          person:store.state.id ,
        }]
      }
    },
    methods: {
      delete(index) {
        this.tableData.splice(index, 1);
        store.dispatch('setText1','');
        store.dispatch('setText2','');
        },
      open() {
        this.$$alert('删除成功', '提示', {
          confirmButtonText: '确定',
          type: 'success'
        })},
    },
  }
</script>